import request from "@/router/axios";

export function delBatch(ids) {
  return request({
    url: "/stm/swstconductorsettle/batchCascadeDel",
    method: "delete",
    data: ids
  });
}

export function mergeObj(obj,Shifts) {
  return request({
    url: "/stm/swstconductorsettle/merge?conductorShifts="+Shifts,
    method: "post",
    data: obj,Shifts
  });
}


export function exportExcel(query) {
  return request({
    url: "/stm/swstconductoradvancepayment/export",
    method: "get",
    params: query,
    responseType: "arraybuffer"
  });
}

export function getConductorAdvancePayment(query) {
  return request({
    url: "/stm/swstconductoradvancepayment/page",
    method: "get",
    params: query
  });
}

export function getConductorAdvancePayments(query1) {
  return request({
    url: "/stm/swstticketpettyadd/page",
    method: "get",
    params: query1
  });
}

export function getMarketDetail(id) {
  return request({
    url: "/stm/swstmarketingticket/details/" + id,
    method: "get"
  });
}

export function getMarketId(query) {
  return request({
    url: "/stm/swstmarketingticket/page",
    method: "get",
    params: query
  });
}

export function fetchList(query) {
  return request({
    url: "/stm/swstconductorsettle/page",
    method: "get",
    params: query
  });
}

export function addObj(obj) {
  //obj.bomCode = obj.bomCode.join(",");
  if(typeof obj.bomCode !== 'string') {
    obj.bomCode = obj.bomCode.join(",");
  }
  return request({
    url: "/stm/swstconductorsettle",
    method: "post",
    data: JSON.parse(JSON.stringify(obj))
  });
}

export function getObj(id) {
  return request({
    url: "/stm/swstconductorsettle/" + id,
    method: "get"
  });
}

export function delObj(id) {
  return request({
    url: "/stm/swstconductorsettle/" + id,
    method: "delete"
  });
}

export function putObj(obj) {
  if(typeof obj.bomCode !== 'string') {
    obj.bomCode = obj.bomCode.join(",");
  }
  return request({
    url: "/stm/swstconductorsettle",
    method: "put",
    data: JSON.parse(JSON.stringify(obj))
  });
}
export function putMerge(obj) {
  if(typeof obj.bomCode !== 'string') {
    obj.bomCode = obj.bomCode.join(",");
  }
  return request({
    url: "/stm/swstconductorsettle",
    method: "put",
    data: JSON.parse(JSON.stringify(obj))
  });
}
//级联删除
export function cascadeDelObj(id) {
  return request({
    url: "/stm/swstconductorsettle/cascadeDel/" + id,
    method: "delete"
  });
}
//级联添加及修改
export function cascadeAddObj(obj) {
  return request({
    url: "/stm/swstconductorsettle/saveOrUpdateSettleAndDetail",
    method: "post",
    data: obj
  });
}

export function getNeedConfirmData(obj) {
  return request({
    url: "/stm/swstconductorsettle/query/needConfirmData",
    method: "post",
    data: obj
  });
}

export function confirm(id) {
  return request({
    url: "/stm/swstconductorsettle/confirm/" + id,
    method: "get"
  });
}

//查看售票员日结算数据录入历史记录
export function queryConductorsettle(param){
  return request({
    url: '/stm/swstconductorsettle/getLogById/'+param.id,
    method: 'get'
  })
}

//导出
export function dataExport(query) {
  return request({
    url: '/stm/swstconductorsettle/dataExport',
    method: 'get',
    responseType: 'blob',
    params: query
  })
}

export function getpassengerwork(query) {
  return request({
    url: '/stm/swstinputpassengerwork/getpassengerwork',
    method: 'get',
    params: query
  })
}

